
// Copyright (C) Recursion Company. All rights reserved.

#ifndef __VOL_CURL_FTP_H__
#define __VOL_CURL_FTP_H__

#include "../vol_curl.h"

class CVolCurlFTP : public CVolCommonBase
{
public:
    static INT sSendCommand (CURL* pCurl, const TCHAR* szFtpServerAddress, const TCHAR* szUserName, const TCHAR* szPassword, const TCHAR* szAccount,
            const TCHAR* szCommand, BOOL_P blpQuote, CVolString* pstrResult);

    static INT sUpload (CURL* pCurl, const TCHAR* szFtpServerAddress, const TCHAR* szUserName, const TCHAR* szPassword, const TCHAR* szAccount,
            const TCHAR* szFtpFileName, const BYTE* pbUploadData, INT_P npUploadDataSize, BOOL_P blpAppend, INT_P npRetryCount);

    static INT sDownload (CURL* pCurl, const TCHAR* szFtpServerAddress, const TCHAR* szUserName, const TCHAR* szPassword, const TCHAR* szAccount,
            const TCHAR* szFtpFileName, CVolMem& memResult);

    static INT sMutilDownload (CURL* pCurl, const TCHAR* szFtpServerAddress, const TCHAR* szUserName, const TCHAR* szPassword, const TCHAR* szAccount,
            const TCHAR* szFtpFileName, const TCHAR* szDownloadLocalDir);

    static INT sGetFileInfo (CURL* pCurl, const TCHAR* szFtpServerAddress, const TCHAR* szUserName, const TCHAR* szPassword, const TCHAR* szAccount,
            const TCHAR* szFtpFileName, INT64* pn64FileSize, DOUBLE* pdbFileTime);

    static CVolString& sNormalizeFtpFileName (const TCHAR* szFtpFileName, CVolString& strResultFileName);

protected:
    static void sInitLogin (CURL* pCurl, const TCHAR* szUserName, const TCHAR* szPassword, const TCHAR* szAccount,
            const TCHAR* szFtpServerAddress, const TCHAR* szFtpFileName);
    static const TCHAR* sMakeFtpFullUrl (const TCHAR* szFtpServerAddress, const TCHAR* szFtpFileName, CVolString& strBuf);
};

#endif
